/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rbh.visanyee.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 *
 * @author IT-Mafia
 */
@Entity
@Table(name = "rbh_risk_workgroup_level")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
@XmlRootElement
public class WorkgroupLevel implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "WORKGROUP_LEVEL_ID", unique = true, nullable = false, columnDefinition = "tinyint(1) UNSIGNED")
    private Byte workgroupLevelId;
    @Column(name = "WORKGROUP_LEVEL_NAME", unique = true, nullable = false, length = 100)
    private String workgroupLevelName;
    @Column(name = "WORKGROUP_LEVEL_DESCRIPTION", length = 1024)
    private String workgroupLevelDescription;
    @OneToMany(mappedBy = "workgroupLevel", fetch = FetchType.LAZY)
    @Cascade({CascadeType.DETACH})
    private List<Workgroup> workgroupList;

    public WorkgroupLevel() {
    }

    public WorkgroupLevel(Byte workgroupLevelId) {
        this.workgroupLevelId = workgroupLevelId;
    }

    public WorkgroupLevel(Byte workgroupLevelId, String workgroupLevelName) {
        this.workgroupLevelId = workgroupLevelId;
        this.workgroupLevelName = workgroupLevelName;
    }

    public Byte getWorkgroupLevelId() {
        return workgroupLevelId;
    }

    public void setWorkgroupLevelId(Byte workgroupLevelId) {
        this.workgroupLevelId = workgroupLevelId;
    }

    public String getWorkgroupLevelName() {
        return workgroupLevelName;
    }

    public void setWorkgroupLevelName(String workgroupLevelName) {
        this.workgroupLevelName = workgroupLevelName;
    }

    public String getWorkgroupLevelDescription() {
        return workgroupLevelDescription;
    }

    public void setWorkgroupLevelDescription(String workgroupLevelDescription) {
        this.workgroupLevelDescription = workgroupLevelDescription;
    }

    public List<Workgroup> getWorkgroupList() {
        return workgroupList;
    }

    public void setWorkgroupList(List<Workgroup> workgroupList) {
        this.workgroupList = workgroupList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (workgroupLevelId != null ? workgroupLevelId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WorkgroupLevel)) {
            return false;
        }
        WorkgroupLevel other = (WorkgroupLevel) object;
        if ((this.workgroupLevelId == null && other.workgroupLevelId != null) || (this.workgroupLevelId != null && !this.workgroupLevelId.equals(other.workgroupLevelId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.rbh.risk.entity.WorkgroupLevel[ workgroupLevelId=" + workgroupLevelId + " ]";
    }
}
